package com.WJY.dao;

import com.WJY.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface DeptDao {
    //查询所有部门
    @Select("select * from dept")
    List<Dept> queryAllDept();

    //根据id查询部门
    @Select("select * from dept where dept_id = #{id}")
    Dept queryDeptById(@Param("id") int id);

    //根据id删除部门
    @Delete("delete from dept where dept_id = #{id}")
    int delDeptById(@Param("id") int id);

    //新增部门
    @Insert("insert into dept (dept_name) values (#{dept_name})")
    int addDept(Dept dept);

    //更新部门
    @Update("update dept set dept_name = #{dept_name} where dept_id = #{dept_id}")
    int updateDept(Dept dept);
}
